import { View } from "../../../../mvc/core/View";
import { CopyMountFrontSp } from "./CopyMountFrontSp";
import { CopyMountBackSp } from "./CopyMountBackSp";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { CopyMountBackInfo } from "./CopyMountBackInfo";
type int = number;
//class CopyMountBoxCell
    
    export  class CopyMountBoxCell extends View
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._front = new CopyMountFrontSp();
            this._back = new CopyMountBackSp();
            addChild(this._front);
            addChild(this._back);
            this._front.visible = false;
            this.isBack = this._back.visible;
            this.addEventListener(flash.events.MouseEvent.CLICK, this.onThisClick);
            return;
        }

        protected onThisClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this.isBack) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.CopyMountClickCard, {"backInfo": this.backInfo, "cost": this._back.cost}));
            }
            return;
        }

        public setBackData(arg1: CopyMountBackInfo): void
        {
            this.backInfo = arg1;
            this._front.visible = false;
            this._back.visible = true;
            this._back.setData(arg1);
            this.isBack = this._back.visible;
            return;
        }

        public setFrontData(arg1: int, arg2: int): void
        {
            this._front.visible = true;
            this._back.visible = false;
            this._front.setData(arg1, arg2);
            this.isBack = this._back.visible;
            return;
        }

        public updateCost(arg1: int): void
        {
            this._back.updateCost(arg1);
            return;
        }

        /* internal */ /* var */_front: CopyMountFrontSp;

        /* internal */ /* var */_back: CopyMountBackSp;

        public /* var */backInfo: CopyMountBackInfo;

        public /* var */isBack: Boolean;
    }
